﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="Reporting.aspx.cs" Inherits="SwenAssigment.Reporting" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .auto-style6 {
            width: 552px;
        }

        .auto-style7 {
            width: 544px;
        }

        .auto-style8 {
            width: 538px;
        }

        .auto-style9 {
            width: 100%;
        }

        .auto-style10 {
            width: 233px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h1 style="text-align: center">Reports</h1>
    <table class="auto-style9">
        <tr>
            <td class="auto-style10">
                <asp:Button ID="GenerateRoomAndStatus" runat="server" Text="Generate all rooms and room status" Width="218px" OnClick="GenerateRoomAndStatus_Click" />
            </td>
            <td>&nbsp;</td>
        </tr>
        <tr>
            <td class="auto-style10">
                <asp:Button ID="GenerateGuestInRoom" runat="server" Text="Generate all guest in room number:" Width="218px" OnClick="GenerateGuestInRoom_Click" />
            </td>
            <td>
                <asp:TextBox ID="RoomNumberTbx" runat="server" Width="70px"></asp:TextBox>
                &nbsp;<asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="Enter a valid room number" ForeColor="Red" Operator="DataTypeCheck" Type="Integer" ControlToValidate="RoomNumberTbx"></asp:CompareValidator>
            </td>
        </tr>
        <tr>
            <td class="auto-style10">
                <asp:Button ID="GenerateGuestOnWhen" runat="server" Text="Generate all guest in all rooms on:" Width="218px" OnClick="GenerateGuestOnWhen_Click" />
            </td>
            <td>
                <asp:ScriptManager ID="ScriptManager1" runat="server">
                </asp:ScriptManager>
                <asp:TextBox ID="DateTbx" runat="server" Width="70px"></asp:TextBox>
                <asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="DateTbx" TodaysDateFormat="dd/MM/yyyy" DaysModeTitleFormat="dd/MM/yyyy"></asp:CalendarExtender>
                &nbsp;
                <asp:CompareValidator ID="CompareValidator2" runat="server" ErrorMessage="Enter a valid date" ForeColor="Red" Operator="DataTypeCheck" Type="Date" ControlToValidate="DateTbx"></asp:CompareValidator>
            </td>
        </tr>
    </table>
    <asp:GridView ID="GridView1" runat="server">
    </asp:GridView>
    <asp:SqlDataSource ID="GenerateRoomStatus" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT Room_ID AS [Room Number], Status FROM Room"></asp:SqlDataSource>
    <asp:SqlDataSource ID="GenerateGuestRoomNum" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT Guest.First_Name AS [First Name], Guest.Last_Name AS [Last Name], Room_Booking.Room_Assigned AS [Room Number] FROM Guest INNER JOIN Room_Booking ON Guest.Guest_ID = Room_Booking.Guest_ID WHERE (Room_Booking.Room_Assigned = @RoomAssigned)">
        <SelectParameters>
            <asp:ControlParameter ControlID="RoomNumberTbx" Name="RoomAssigned" PropertyName="Text" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="GenerateGuestDate" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT Guest.First_Name AS [First Name], Guest.Last_Name AS [Last Name], Room_Booking.Room_Assigned AS [Room Number], Room_Booking.Checkin_DateTime AS Date FROM Guest INNER JOIN Room_Booking ON Guest.Guest_ID = Room_Booking.Guest_ID WHERE (Room_Booking.Checkin_DateTime = @CheckinDateTime)">
        <SelectParameters>
            <asp:ControlParameter ControlID="DateTbx" Name="CheckinDateTime" PropertyName="Text" Type="DateTime" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:Label ID="NoDataFoundLbl" runat="server" ForeColor="Red" Text="No Data Found!" Visible="False" Style="text-align: center"></asp:Label>
    <br />
    <asp:Label ID="NoDataEnteredLbl" runat="server" ForeColor="Red" Style="text-align: center" Visible="false" Text="Textbox was empty!"></asp:Label>
    <br />
    <asp:Button ID="ExportExcelBtn" runat="server" Text="Export to Excel" OnClick="ExportExcelBtn_Click" Visible="False" />
    <br />
</asp:Content>
